External Byte Input/Output (8 bits) with Direction Register
Typical usage of the bean in user's code.
Typical Usage:
Assume the bean name "EBt1".
Some examples of typical usage of this bean are the following:
(1)
The direction of the bean is set to input.
MAIN.C
void main(void)
{
/* Wait until "10101010" is on the port */
while( EBt1_GetVal() != 0xAA );
:
}
(2)
The direction of the bean is set to output.
MAIN.C
void main(void)
{
EBt1_PutVal(0xAA); // "10101010" is on the port
for (;;) {
/* Invert output level of fourth pin on the port */
EBt1_NegBit(3);
}
}
(3)
The direction of the bean is set to input/output.
MAIN.C
void main(void)
{
EBt1_SetDir(FALSE); // Set input mode
/* Wait until "11111111" is on the port */
while( EBt1_GetVal() != 0xFF );
EBt1_SetDir(TRUE); // Set output mode
EBt1_PutVal(0); // Set "00000000" on the port
}
For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.